#pragma once
#include "psyche.h"

namespace cupid
{

class Socket
{
public:
	Socket(void);
	~Socket(void);
protected:
	SOCKET	m_sockClient;
	BOOL	m_state;
	char	m_bufInput[INBUFSIZE];
	int		m_inbufLen;
	int		m_inbufStart;				
	char	m_bufOutput[OUTBUFSIZE];	
	int		m_outbufLen;
public:
	BOOL	create(char* szServerIP, int serverPort, BOOL keepAlive = FALSE);
	BOOL	sendMsg(void* buf, int size);
	BOOL	receiveMsg(void* buf, int& size);
	BOOL	flush(void);
	BOOL	check(void);
	void	destroy(void);

private:
	BOOL	recvFromSock(void);
};

}